package com.zj.ssm.controller;

import com.zj.ssm.pojo.domain.query.NewsOpinionsQuery;
import com.zj.ssm.pojo.domain.query.NewsStatusQuery;
import com.zj.ssm.pojo.domain.vo.NewsVO;
import com.zj.ssm.result.AjaxResult;
import com.zj.ssm.service.NewsStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author wxr
 * @version 1.0
 * @date 2022/1/14 10:23
 */
@RestController
@RequestMapping("show")
public class NewsStatusController {

    @Autowired
    private NewsStatusService newsStatusService;

    @RequestMapping("queryStatus")
    public AjaxResult queryStatus(NewsStatusQuery newsStatusQuery){
        return newsStatusService.queryAll(newsStatusQuery);
    }

    @RequestMapping("queryShowNews")
    public AjaxResult queryShowNews(NewsOpinionsQuery newsOpinionsQuery){
        return newsStatusService.queryNews(newsOpinionsQuery);
    }

    @RequestMapping("get/{id}")
    public AjaxResult get(@PathVariable("id") Integer id){

        return newsStatusService.getNews(id);
    }

    @RequestMapping("update")
    public AjaxResult updateNews(NewsVO newsVO){
        return newsStatusService.update(newsVO);
    }


}
